<h1>New Message</h1>
<form action="<?php echo BASE_PATH; ?>/messages/add" method="post" onsubmit="return validate_message(this)">
    <label for="recipient">Send to:</label><br/>
    <?php
        if(isset($_SESSION['user_list'])) {
            foreach($_SESSION['user_list'] as $user):
    ?>
        <label name="user[]" class="labeluser"><?php echo $user; ?></label><br/>
    <?php
            endforeach;
        } else { ?>
            <label name="user[]" class="labeluser">No Recipient</label><br/>
        <?php }
    ?>
    <span id="block"><input type="button" onclick="popUp('<?php echo BASE_PATH; ?>/messages/add_recipient')" value="Choose Recipient" id="popup"/></span><br />
    <label for="subject">Subject:</label>
    <input type="text" name="subject" id="subject"/><br />
    <input type="hidden" name="author_user_id" value="<?php echo $this->session->get('user_id') ?>"/><br />
    <label for="message_content">Message:</label>
    <textarea cols="10" rows="3" name="message_content" id="message_content"></textarea><br />

    <input type="submit" name="submit" id="submit" value="Send" />
    <a href="<?php echo BASE_PATH; ?>/messages/show/<?php echo $this->session->get("user_id"); ?>">
        <input type="button" name="cancel" id="cancel" value="Cancel" />
    </a>
</form>